package com.wavehi.mapper;

import com.wavehi.pojo.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author WaveHi
 * @Date 26/9/2021 下午 3:08
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description CRUD for table t_user_02
 */
public interface IUserMapper {

    /**
     * Add a user information to the database.
     * @param user an object that encapsulates the user information.
     * @return return false indicate that add failed.
     */
    Boolean insert(User user);

    /**
     * Delete a user information from database.
     * @param id id corresponding the user.
     * @return return false indicate that delete failed.
     */
    Boolean deleteById(Long id);

    /**
     * update a user information from database.
     * @param user an object that encapsulates the user information for update.
     * @return return false indicate that update failed.
     */
    Boolean update(User user);

    /**
     * Query a user information from database according to id corresponding to user.
     * @param id the id corresponding to user
     * @return return an object that encapsulates the user information.
     */
    User selectById(Long id);

    /**
     * Query a user information from database according to user name.
     * @param username user name.
     * @return return an object that encapsulates the specified user information.
     */
    User selectByUsername(String username);

    /**
     * Query a user information from database according to user name and password.
     * @param username user name
     * @param password password
     * @return return an object that encapsulates the specified user information.
     */
    User selectByUsernameAndPassword(@Param("username")String username, @Param("password")String password);

    /**
     * Query all user information from database.
     * @return return a list that contains all the user information.
     */
    List<User> selectAll();
}
